package com.study.selenium.page.google;


import com.study.selenium.annotation.Page;
import com.study.selenium.page.Base;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.factory.annotation.Autowired;

@EqualsAndHashCode(callSuper = true)
@Data
@Page // using custom annotation created; src/main/java/com/demo/seleniumspring/annotation/Page.java
public class GooglePage extends Base {

    @Autowired
    private SearchComponent searchComponent;


    //launch website
    public void goToGooglePage(String url) {
        // 最大化浏览器窗口
        driver.manage().window().maximize();
        // 打开网页
        this.driver.get(url);
    }

    @Override
    public boolean isAt() {
        return this.searchComponent.isAt();
    }

    public void close() {
        // 关闭浏览器
        this.driver.quit();
    }
}
